import { service } from "./service"

// https://api.youlai.tech/api/v1
function createRequest(service){
	function request(config,isSeriver = true){
		// 是否已经接通后端，否则使用mock
		const SERVICER_PORT = isSeriver ? 'https://api.youlai.tech' : ''
		
		// axios的默认配置
		const configDefault = {
			baseURL: `${SERVICER_PORT}/api/v1`,
			timeout: 15000,
			responseType: 'json',
			headers:{
				
			}
		}
		// config自定义配置
		const requestConfig = Object.assign(configDefault, config)
		return service(requestConfig)
	}
	return request
}

export const request = createRequest(service)